package cn.snow.iot.module.warning.dal.mysql.config;


import cn.snow.iot.module.warning.controller.admin.config.vo.WarningPageVO;
import cn.snow.iot.module.warning.controller.admin.home.vo.EquipmentRelateWarningVO;
import cn.snow.iot.module.warning.controller.admin.home.vo.WarningConfigStatusVO;
import cn.snow.iot.module.warning.dal.dataobject.config.WarningDO;
import cn.snow.iot.module.warning.enums.api.config.vo.ConfigCountVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

@Mapper
public interface WarningMapper extends BaseMapper<WarningDO> {
    IPage<WarningDO> selectProductPage(IPage<WarningDO> page, @Param("entity") WarningPageVO warningPageVO);

    @Select("select * from warning_config where deleted = 0 and rule_id = #{id}")
    WarningDO getByRuleId(Long id);

    List<ConfigCountVO> getWarningCountByEquipmentId(@Param("ids") List<Long> ids);

    @Select("select count(*) from warning_config where deleted = 0")
    Integer getConfifCount();

    List<EquipmentRelateWarningVO> getEquipmentRelateWarning();

    @Select("select * from warning_config where deleted = 0 and equipment_id = #{id}")
    List<WarningDO> selectByEquipmentId(Long id);

    List<WarningConfigStatusVO> getStatusCount();
}
